package common;

public class StudyNote {
    public static void main(String[] args) {
    }
    private static void binary(int n){
        int k = 3;
        //取n二进制的后k位
        int a1 = n & ((1 << k) - 1);
        //第k位取反
        int a2 = n ^ (1 << k);
        //第k位赋1
        int a3 = n | (1 << k);
        //第k位赋0 (~表示取反)
        int a4 = n & (~(1 << k));
        //lowbit  -1 - n == ~n
        int a5 = n & (-n);
        //n除lowbit
        int a6 = n & (n - 1);
    }

    //01状态压缩枚举子集
    private static void getAll(int n){
        //递减枚举
        for(int i = n; i > 0; i = (i - 1) & n){
            System.out.println(Integer.toBinaryString(i));
        }
    }
}
